import { h } from 'vue';
import { Tag } from '@arco-design/web-vue';
import { BasicColumn } from '@/components/Table';

const receiveTypeMsg = ['公告', '会议', '其他'];

export const columns: BasicColumn[] = [
  {
    title: '标题',
    dataIndex: 'title',
    width: 350,
  },
  {
    title: '类型',
    dataIndex: 'noticeType',
    render({ record }) {
      return h(
        Tag,
        {
          type: 'default',
        },
        {
          default: () => receiveTypeMsg[record.noticeType - 1],
        },
      );
    },
  },
  {
    title: '发送者',
    dataIndex: 'username',
  },
  {
    title: '发送时间',
    dataIndex: 'sendTime',
  },
  {
    title: '阅读状态',
    dataIndex: 'isRead',
    render({ record }) {
      return h(
        Tag,
        {
          type: record.isRead ? 'success' : 'info',
        },
        {
          default: () => (record.isRead === 1 ? '已读' : '未读'),
        },
      );
    },
  },
];
